<!DOCTYPE html>
<html lang="en">
<#--<link rel="stylesheet" href="/css/frame.css"/>-->
<link rel="stylesheet" href="/css/common/add.css"/>
<script type="text/javascript" src="${ctx}/plugin/jquery/jquery-2.1.1.js"></script>
<script type="text/javascript" src="${ctx}/plugin/jquery/jquery.form.js"></script>
<script type="text/javascript" src="${ctx}/plugin/jquery/jquery-validation/jquery.validate.min.js"></script>
<script type="text/javascript" src="${ctx}/plugin/layer-v1.9.2/layer/layer.js"></script>
<script type="text/javascript" src="${ctx}/common/common.js"></script>
<#--<table id="dynamic-table" class="table table-striped table-bordered table-hover dataTable no-footer" role="grid"
       aria-describedby="dynamic-table_info">
    <thead>
    </thead>
    </tbody>
    <tbody>
    <tr></tr>
    <tr>
        <th>
            <button onclick="submitReturn()">确定</button>
        </th>
    </tr>
    </tbody>
</table>-->

<body>
<div class="l_err" style="wid 100%; margin-top: 2px;"></div>
<form id="form" name="form" class="form-horizontal" method="post"
      action="/taskManage/submitReturn"
      enctype="multipart/form-data">
    <input id="taskId" name="taskId" value="${taskId}" type="hidden"/>
    <section class="">
        <div class="form-layer-group clearfix">
            <div class="form-group-div form-layer-input clearfix">
                <#--<label class="control-label">原因：</label>-->
                <#--<input id="returnText" type="text">-->
                    <textarea rows="3" cols="20" type="text" name="reason"  style="height: 50px" placeholder="请输入原因" class="input-medium"id="returnText" value=""></textarea>
            </div>
            <div style="text-align: center;padding:12px 0px">
                <button type="button" class="cancel btn btn-cancel">取消</button>
                <button type="submit" id="submitButton" class="btn btn-main">确定</button>
            </div>
        </div>
    </section>
</form>
</body>
</html>
<script>
    $(function () {
        // 绑定取消按钮事件
        $(".cancel").click(function() {
            parent.layer.close(parent.pageii);
        });
        $("form").validate({
            submitHandler: function (form) {// 必须写在验证前面，否则无法ajax提交
                if ($("#returnText").val() == '') {
                    layer.msg('请填写打回原因');
                    return false;
                }
                //jquery获取复选框值
                // var chk_value =[];//定义一个数组
                var index = layer.load(1, {shade: false});
                $("#submitButton").attr("disabled","disabled");
                $(form).ajaxSubmit({
                    dataType:"text",
                    success:function( data ){
                        $("#submitButton").removeAttr("disabled");
                        layer.close(index);
                        if (data == "success") {
                            layer.confirm('打回成功!是否关闭窗口?', function (index) {
                                // parent.grid.loadData();
                                layer.close(index);
                                parent.location.href = '/taskManage/closedLoopTask';
                                parent.layer.close(parent.pageii);
                                return false;
                            });
                        } else {
                            layer.alert('打回失败！', 3);
                        }
                    }
                });
            },
            errorPlacement: function (error, element) {// 自定义提示错误位置
                $(".l_err").css('display', 'block');
                // element.css('border','3px solid #FFCCCC');
                $(".l_err").html(error.html());
            },
            success: function (label) {// 验证通过后
                $(".l_err").css('display', 'none');
            }
        });
    });
</script>